package org.blaznyoght.subtitles.ui;

import java.awt.Component;

import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.table.DefaultTableCellRenderer;

public class TextRenderer extends DefaultTableCellRenderer {
	/**
	 * 
	 */
	private static final long serialVersionUID = -4887765115773516151L;
	
	/* (non-Javadoc)
	 * @see javax.swing.table.DefaultTableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int)
	 */
	@Override
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean hasFocus, boolean isSelectable, int row, int Column) {
		JTextArea text = new JTextArea();
		String textString = (String) value;
		int count = textString.split("\n").length - 1;
		text.setRows(count);
		return text;
	}

}
